﻿using System.Collections.Generic;
using System.Linq;

namespace Inscriptionem.Areas.Inscriptionem.Models.Views
{
    public class MemberSearchCollectionViewModel
    {
        public IEnumerable<ORM.Member> Members { get; protected set; }

        public MemberSearchCollectionViewModel()
        {
            Members = new ORM.DB().Members.Where(m => m.IsRegistrationApproved &&
                                                      (m.FirstName.ToLower().Contains(Text) || m.NickName.ToLower().Contains(Text) || m.LastName.ToLower().Contains(Text) ||
                                                       m.Mail.ToLower().Contains(Text))).OrderBy(m => m.ID);
        }

        public string Text { get; set; }
        public int Page { get; set; }
    }
}